package main

import (
	"feishu/src/bootstrap"
	"feishu/src/global"
	"feishu/src/handler"
	"github.com/gin-gonic/gin"
)

func setupRouter() *gin.Engine {
	r := gin.Default()
	// notification-success
	r.POST("/notification-success", handler.SendSuccessNotification())
	// notification-fail
	r.POST("/notification-fail", handler.SendFailNotification())
	return r
}

type Config struct {
	App AppConfig `json:"app"`
}

type AppConfig struct {
	Port int `json:"port"`
}

//func loadConfig() Config {
//	return nil
//}

func main() {
	bootstrap.InitializeConfig()
	r := setupRouter()
	// Listen and Server in 0.0.0.0:8080
	r.Run(":" + global.App.Config.App.Port)
}
